import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/views/Layout/index.vue'

const routes = [
  {
    path: '/',
    name: 'layout',
    component: Layout
  },
  {
    path: '/consult',
    name: 'consult',
    component: () => import('@/views/Consult')
  },
  {
    path: '/research',
    name: 'research',
    component: () => import('@/views/Research')
  },
  {
    path: '/animation',
    name: 'animation',
    component: () => import('@/views/Animation')
  },
  {
    path: '/contact',
    name: 'contact',
    component: () => import('@/views/Contact')
  },
  {
    path: '/details',
    name: 'details',
    component: () => import('@/views/Details')
  }
]

const router = createRouter({
  routes,
  history: createWebHashHistory(process.env.BASE_URL),
  // scrollBehavior: (to, from, savedPosition)=> {
  //   console.log(to, from, savedPosition);
  //   return { x: 0, y: 0}
  // },
})
router.afterEach((to, from, next) => {
  console.log(to, from, next);
  window.scrollTo(0,0)
})
export default router
